USE VehicleShowroom
go
create proc getAllEmployee
as select * from EMPLOYEES
go
create proc editEmployee
	
	@UserName NVARCHAR(50) ,
	@Password NVARCHAR(50),
	@FullName NVARCHAR(100),
	@Phone NVARCHAR(50),
	@Email NVARCHAR(50),
	@Address NVARCHAR(1000),
	@BrandID int,
	@position int
	AS
update EMPLOYEES SET 
	Password = @Password,
	FullName = @FullName,
	Phone = @Phone,
	Email = @Email,
	Address = @Address,
	BrandID = @BrandID,
	position = @position
Where UserName = @UserName
go
--------------------------------------------------------------------------------------------
create proc deleteEmployee
 @UserName NVARCHAR(50) 
as
delete EMPLOYEES where UserName=@UserName
go
---------------------Position = 2----------------------------------------------------------
go
create proc editEmployee2
	
	@UserName NVARCHAR(50) ,
	@Password NVARCHAR(50),
	@FullName NVARCHAR(100),
	@Phone NVARCHAR(50),
	@Email NVARCHAR(50),
	@Address NVARCHAR(1000)
	
	AS
update EMPLOYEES SET 
	Password = @Password,
	FullName = @FullName,
	Phone = @Phone,
	Email = @Email,
	Address = @Address

Where UserName = @UserName
GO
-------------------------------------------------------------------------------------
-- Proc tinh

--
go
--
CREATE PROC checkEmail
@email VARCHAR(50)
AS
SELECT e.Email FROM EMPLOYEES e
WHERE e.Email=@email

--
go
--
CREATE PROC updatePassword
@email VARCHAR(50),
@newpass VARCHAR(50)
AS
UPDATE EMPLOYEES
SET
    [Password] =@newpass
WHERE  Email=@email
